<template>
  <a-table :dataSource="feeTable">
    <a-table-column v-for="(item, iii) in otherCol" :key="iii" :title="item">
      <template #default="{ record }">
        <a-input v-model:value="record[item]" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <a-table-column title="图片" data-index="image">
      <template #default="{ record }">
        <div v-if="record.image" class="pictrue tabPic">
          <img :src="record.image">
        </div>
        <upload-img v-else v-model="record.image" placeholder="门店logo" />
      </template>
    </a-table-column>
    <a-table-column title="售价" data-index="price">
      <template #default="{ record }">
        <a-input v-model:value="record.price" :max="record.price" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <a-table-column title="成本价" data-index="cost">
      <template #default="{ record }">
        <a-input v-model:value="record.cost" :max="record.price" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <a-table-column title="原价" data-index="stock">
      <template #default="{ record }">
        <a-input v-model:value="record.stock" :max="record.price" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <a-table-column title="库存" data-index="stock">
      <template #default="{ record }">
        <a-input v-model:value="record.brokerage" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <a-table-column title="商品编号" data-index="barCode">
      <template #default="{ record }">
        <a-input v-model:value="record.barCode" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <a-table-column title="重量（KG）" data-index="weight">
      <template #default="{ record }">
        <a-input v-model:value="record.weight" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <a-table-column title="体积(m³)" data-index="volume">
      <template #default="{ record }">
        <a-input v-model:value="record.volume" :max="record.price" min="0" class="priceBox" />
      </template>
    </a-table-column>
    <template v-if="isSub">
      <a-table-column title="一级返佣(元)" data-index="brokerage">
        <template #default="{ record }">
          <a-input v-model:value="record.brokerage" :max="record.price" min="0" class="priceBox" />
        </template>
      </a-table-column>
      <a-table-column title="二级返佣(元)" data-index="brokerageTwo">
        <template #default="{ record }">
          <a-input v-model:value="record.brokerage" :max="record.price" min="0" class="priceBox" />
        </template>
      </a-table-column>
    </template>
    <a-table-column title="操作" data-index="brokerageTwo">
      <template #default="{ index }">
        <a-button type="link" class="submission" @click="delone(index)">
          删除
        </a-button>
      </template>
    </a-table-column>
  </a-table>
</template>

<script setup lang="ts">
const props = withDefaults(
  defineProps<{
    isSub: boolean;
    goods: any[];
    otherCol: {}
  }>(),
  {
  }
);
let feeTable = computed(() => [...props.goods])
onMounted(() => { });
const emit = defineEmits(['uploadAttrD']);
function delone(i) {
  emit('delTable', i)
}
</script>

<style lang="less"></style>
